<template>
  <h1>EL-菜单组件</h1>
<!--   horizontal 水平的  v 开头是竖着的菜单栏 -->
  <el-menu @select="handleSelect" active-text-color="blue" mode="horizontal"  background-color="lightblue" text-color="red">
    <el-menu-item index="1">首页</el-menu-item>
    <el-menu-item index="2">免费课</el-menu-item>
    <el-menu-item index="3">直播课</el-menu-item>
    <el-menu-item index="4">线上课</el-menu-item>
    <el-menu-item index="5">脱产课</el-menu-item>
    <el-sub-menu index="6">
<!--      <template #title> 可以写  el-sub-menu 的标题  -->
      <template #title>关于我们</template>
      <el-menu-item index="6-1">联系方式</el-menu-item>
      <el-menu-item index="6-2">公司地址</el-menu-item>
      <el-menu-item index="6-3">求职招聘</el-menu-item>
    </el-sub-menu>
  </el-menu>
</template>


<script setup>
import {ElMessage} from "element-plus";

// indexPath 展示的数值是数组 比如[6,6-3] 路径就是 先到达的是6,然后是 6-3
const handleSelect = (index, indexPath) => {
  console.log(index, indexPath);
  if (index ==3){
    ElMessage.success("您选择了直播课!");
  }
}
</script>

<style scoped>

</style>